package com.wzy.business.base.photo

import android.text.TextUtils
import com.blankj.utilcode.util.GsonUtils
import com.blankj.utilcode.util.SPUtils
import com.google.gson.Gson
import com.wangzhenyu.common.base.bean.LoginInfo
import com.wangzhenyu.common.base.bean.UserManager
import com.wzy.business.base.photo.bean.LoginDuckResult

object DuckManager {


    //烤鸭图床Token

    fun setDuckLoginInfo(info: LoginDuckResult) {
        SPUtils.getInstance().put("login_duck", GsonUtils.toJson(info))
        SPUtils.getInstance().put("isDuckLogin", true)
    }

    fun isLogin(): Boolean {
        return SPUtils.getInstance().getBoolean("isLogin", false)
    }


    fun getDuckLoginInfo(): LoginDuckResult? {
        val loginInfoString = SPUtils.getInstance().getString("login_duck", null)
        return if (!TextUtils.isEmpty(loginInfoString))
            Gson().fromJson(loginInfoString, LoginDuckResult::class.java)
        else
            null
    }

}